package no.uib.hplims.models.peptideinformation;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OneToMany;

import org.vaadin.appfoundation.persistence.data.AbstractPojo;

@Entity
public class PeptideInformation extends AbstractPojo {

	private static final long serialVersionUID = 626166598474661077L;

	@OneToMany(cascade=CascadeType.PERSIST)
	private List<Transition> transitions = new ArrayList<Transition>();
	
	@OneToMany(cascade=CascadeType.PERSIST)
	private List<Storage> storageInfo = new ArrayList<Storage>();
	
	@OneToMany(cascade=CascadeType.PERSIST)
	private List<ResponseCurve> responseCurves = new ArrayList<ResponseCurve>();
	
	private String comment = "";
	private String quality;
	private String modification;
	private boolean optimized = false;
	private String machine;
	private String initials;
	
	public PeptideInformation() {

	}

	public List<Transition> getTransitions() {
		return transitions;
	}

	public void setTransitions(ArrayList<Transition> transitions) {
		this.transitions = transitions;
	}

	public void addTransition(Transition t) {
		if (!transitions.contains(t)) {
			this.transitions.add(t);
		}
	}

	public void deleteTransition(Transition t) {
		if (this.transitions.contains(t)) {
			this.transitions.remove(t);
		}
	}

	public List<Storage> getStorageInfo() {
		return storageInfo;
	}

	public void setStorageInfo(ArrayList<Storage> storageInfo) {
		this.storageInfo = storageInfo;
	}
	
	public void addStorage(Storage s) {
		if (!this.storageInfo.contains(s)) {
			this.storageInfo.add(s);
		}
	}
	
	public void deleteStorage(Storage s) {
		if (this.storageInfo.contains(s)) {
			this.storageInfo.remove(s);
		}
	}

	public List<ResponseCurve> getResponseCurves() {
		return responseCurves;
	}

	public void setResponseCurves(ArrayList<ResponseCurve> responseCurves) {
		this.responseCurves = responseCurves;
	}

	public void addResponseCurve(ResponseCurve rc) {
		if (!responseCurves.contains(rc)) {
			responseCurves.add(rc);
		}
	}
	
	public void deleteResponseCurve(ResponseCurve rc) {
		if (responseCurves.contains(rc)) {
			responseCurves.remove(rc);
		}
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}
	
	public String getQuality() {
		return quality;
	}

	public void setQuality(String quality) {
		this.quality = quality;
	}

	public String getModification() {
		return modification;
	}

	public void setModification(String modification) {
		this.modification = modification;
	}

	public boolean isOptimized() {
		return optimized;
	}

	public void setOptimized(boolean optimized) {
		this.optimized = optimized;
	}

	public String getMachine() {
		return machine;
	}

	public void setMachine(String machine) {
		this.machine = machine;
	}

	public String getInitials() {
		return initials;
	}

	public void setInitials(String initials) {
		this.initials = initials;
	}
}
